/***************************** 	
FILE NAME:  ebraw_1-10.do
DATE:		3/2024
PURPOSE:    1. Drop parties that did not make into parliament
            2. Sort into party families 
			3. Combine EB and ESS figures 
INPUT:      ZA3521_F1.dta
OUTPUT:		1. eb_modified1-10
			1. Figure 1a Figure 1b
			2. Figure F1a Figure F1b
				
LOG FILE:   ebraw.log
AUTHOR:     Odelia Oshri, Lotem Halevy, Orit Kedar
********************************/

use "C:\Users\User\Downloads\ZA3521_v2-0-1.dta (2)\ZA3521_v2-0-1.dta", clear
capture log using "ebraw.log", replace
cd "C:\Users\User\Desktop\Figures"
set more off

* Recode sex
tab sex
recode sex 2=0 1=1
drop if sex>1
tab sex
label define sex 0 "F" 1 "M", replace
label values sex sex
tab sex
rename sex gndr

**Drop non voters**
drop if voteint==.
* Drop Northern Ireland and East Germany
drop if nation1==10|nation1==14	

/* 1. Drop parties that didn't make it to parliament */
drop if nation1==17 & (voteint<100 | voteint>800)
* UK
keep if (nation1==9 &  (voteint==200| voteint==500 | voteint==301 | voteint==700 | (voteint==701&year>=1974)| (voteint==302 & (year>=1987&year<=1)))) | ///
		(nation1==13 & (voteint==200 | voteint==300 | voteint==101 | voteint==201| (voteint==203 & (year>=1985&year<=1990)) | (voteint==204 & (year>=1985&year<=1986)))) | ///
		(nation1==5 & ((voteint==400 & year<=1991) | (voteint==100 & year<=1991) | (voteint==200 & year<=1995) | (voteint==600 & year<=1993) | (voteint==300 & year<=1993) | (voteint==301 & year<=1993) | (voteint==201 & year<=1993) | voteint==700 | (voteint==101 & year<=1975) | (voteint==601 & year<=1975) | voteint==205 & (year>=1976&year<=1993) | voteint==104 & (year>=1976&year<=1991) | (voteint==707 & (year>=1979&year<=2000)) | voteint==704 & year>=1983 | (voteint==800 & year>=1987) | (voteint==9 & (year>=1992&year<=2000)) |(voteint==102 & year>=1992) | (voteint==500 & year>=1994)  |(voteint==603 & year>=1994) |(voteint== 103 & year>=1994) | (voteint==401 & (year>=1994&year<=2000)) | (voteint==403 & year>=1994) | (voteint==10  & (year>=1994&year<=1995))  | (voteint==402 & year>=1994))) |  ///
		(nation1==11 & (voteint==400| voteint==200 | (voteint==300 & year==1980) | (voteint==101 &(year<=1988 | year>=1996)) | (voteint==9 & year==1980) | (voteint==301 & year==1980) | (voteint==100 & (year==1980 | year>=1985)) | (voteint==5 & (year<=1993&year>=1995)) | (voteint==401 & (year>=1989&year<=1992)) | (voteint==10 & (year>=1996&year<=1999)))) |  ///
		(nation1==8 & (voteint==500| voteint==400| voteint==200 | voteint==2 | (voteint== 300 & year>=1987) | (voteint==201 &(year>=1981&year<=1991)) | (voteint==800 &year>=1989) | (voteint==202 &year>=1992) | (voteint==100 &year>=1997)))  | ///
		(nation1==7 & (voteint==200| voteint==500 | voteint==101 | voteint==300 | (voteint==600 &year>=1973) | voteint==302 | (voteint==400 & year>=1973) | (voteint==401 &((year>=1973&year<=1993) | year>=2001)) | (voteint==100 &(year>=1973&year<=1978)) | (voteint==201 &(year>=1975&year<=1986)) | (voteint==7 &year>=1994) | (voteint== 104 &year==1987) | (voteint==701 & (year>=1973&year<=1980)) | (voteint== 601 &year>=1998))) | ///
		(nation1==3 & (voteint==200| (voteint==407 & (year>=1991&year<=1980)) | (voteint==100 & year<=1985) | (voteint==203 & (year>=1991&year<=1988)) | (voteint==201 & year<=1988) | (voteint==404 & (year>=1982&year<=1985)) | (voteint==800 & year>=1989) | (voteint==202 & year>=1994) | (voteint==405 & year<=1976) | (voteint==406 & year<=1976) | (voteint==408 & year<=1976) | (voteint==400 & year>=1977) | voteint==401 | voteint==402 | (voteint==403 &year>=1981) | (voteint==409 &(year>=1972&year<=1976)) | voteint==300 | voteint==301 | (voteint==900 & year<=1980) | voteint==19 & (year>=1994& year<=1997) | voteint==300 | (voteint==600 & (year>=1982& year<=1985))))   | ///
		(nation1==4 & (voteint==200 | voteint==300 | voteint==400| (voteint==800 &(year>=1983&year<=1989)) | (voteint==805 &year>=1990)  | (voteint==103 &year>=1990)))  | ///
		(nation1==18 & (voteint==200 | voteint==401 | voteint==800 |voteint==600 | voteint==301 &(year>=1994&year<=1998))) | ///
		(nation1==15 & (voteint==200 | voteint==500 | voteint==600 | voteint==201 | voteint==400 | voteint==900 | (voteint==700 & year<=1992) | (voteint==300 & year>=1993) | (voteint==103 & (year>=1993&year<=1996)))) | ///
		(nation1==16 & (voteint==500 | voteint==200 | (voteint==601 & year>=1999) | voteint==900 | voteint==100 | voteint==800 | voteint==700 | voteint==600 | (voteint==901 &year<=1995) | (voteint==2 & (year>=1995&year<=1998)) | (voteint==300 & year<=1998) | (voteint==802 & (year>=1995 &year<=1998)) | (voteint==8 & year>=1999)))  | ////
		(nation1==6 & (voteint==400 | voteint==200 | voteint==300 | (voteint==803 & year>=1984) | (voteint==7 & year>=1989) | (voteint==101 & year>=1999)  | (voteint==100 & year<=1993) | (voteint==201 & (year>=1974&year<=1983)))) | ///
		(nation1==1 & (voteint==100 | (voteint==200 & year>=1973) | (voteint==300 & year>=1978) | (voteint==402 & year>=1978) | voteint==500 | (voteint==11  & year<=1977)  | (voteint==202 & year<=1972)  | (voteint==12  & year<=1977)  | (voteint==600 & year>=1986) | (voteint==14  & (year>=1973&year<=1977)) | (voteint==201 & (year>=1973&year<=1977)) | (voteint==502 & (year>=1981&year<=1985)) | (voteint==403 & (year>=1986&year<=1987)) | (voteint==801 & year>=1997) | (voteint==506 & year>=1997))) | ///
		(nation1==2 & (voteint==401| voteint==200| (voteint==201 & ((year>=1971&year<=1973) | year>=1977)) | (voteint==203 & (year>=1971&year<=1973)) | voteint==700 | (voteint==300 & year<=1994) | (voteint==400 & year>=1971) | (voteint==703 & year<=1980) | (voteint==402 & (year>=1971&year<=1973)) | (voteint==701 & ((year>=1971&year<=1973) | (year>=1981&year<=1984))) | (voteint==304 & (year>=1971&year<=1973)) | (voteint==100 & ((year>=1978&year<=1984) |  year<=1974))  | (voteint==308 & (year>=1971&year<=1973)) | (voteint==303 & (year>=1974&year<=1976)) | (voteint==702 & (year<=1970 |(year>=1977&year<=1980) | (year>=1985&year<=1994)))  | (voteint==301 & year>=1977) | (voteint==600 & year>=1978) | (voteint==801 & year>=1981) | (voteint==800 & year>=1981) | (voteint==601 & year>=1991) | (voteint==1 & (year>=1978&year<=1986)) | (voteint==2 & (year>=1991&year<=1994)) | (voteint==306 & year>=1995))) | ///	 	
		(nation1==12 & (voteint==200 | voteint==500| (voteint==102 &year<=1985)| (voteint==3 &year<=1992) | (voteint==100 &year>=1986) | voteint==301 | voteint==701 | (voteint==700 &year<=1999) | (voteint==302 &year<=1985) | (voteint==300 &year<=1992) | voteint==9 &((year>=1989&year<=1992) | year>=2000) | (voteint==20 & (year<=1985 | year>=1993)) | (voteint==22 & (year>=1986&year<=1992)) | (voteint==21 & (year>=1986&year<=1999)) | (voteint==27 & year>=199) | (voteint==701 & (year>=1989&year<=1992)) | (voteint==706 &year>=2000) | (voteint==23 & year>=1996))) |  nation1==17
		
/* 2. Define party families */
/*key for party coding, 
tens digit of party families is as the following:
   Communist           1
   Left (21 SD; 22RL)  2
   Green		       3
   Liberal		       4
   Religious/CD	       5
   Aggrarian	       6
   Conservative	       7
   Radical Right       8
   Ethnic/Regional     9  
*/
/*Four sources of party family*/
gen prtyfam_lmn=.
gen prtyfam_glm=.
gen prtyfam_gn=.
gen prtyfam_ours=.
*FR
replace prtyfam_lmn=11 if nation1==1 & voteint==100
replace prtyfam_gn=11 if nation1==1 & voteint==100
replace prtyfam_lmn=21 if nation1==1 & voteint==200 /*PS*/
replace prtyfam_ours=22 if nation1==1 & voteint==300 /*LEFT RADICALS*/
replace prtyfam_ours=71 if nation1==1 & voteint==500
replace prtyfam_lmn=81 if nation1==1 & voteint==600
replace prtyfam_gn=83 if nation1==1 & voteint==600
replace prtyfam_ours=31 if nation1==1 & voteint==801
replace prtyfam_lmn=71 if nation1==1 & voteint==302
replace prtyfam_lmn=71 if nation1==1 & voteint==301
replace prtyfam_ours=71 if nation1==1 & voteint==302
replace prtyfam_ours=71 if nation1==1 & voteint==301
replace prtyfam_lmn=51 if nation1==1 & voteint==14
replace prtyfam_lmn=22 if nation1==1 & voteint==201
replace prtyfam_glm=52 if nation1==1 & voteint==400
replace prtyfam_ours=71 if nation1==1 & voteint==402
replace prtyfam_ours=71 if nation1==1 & voteint==505
replace prtyfam_ours=71 if nation1==1 & voteint==11
replace prtyfam_ours=51 if nation1==1 & voteint==12
replace prtyfam_ours=11 if nation1==1 & voteint==202
replace prtyfam_ours=71 if nation1==1 & voteint==506

*BE
replace prtyfam_lmn=21 if nation1==2 & voteint==200/*ps(Socialist Party-W)*/
replace prtyfam_lmn=11 if nation1==2 & voteint==100
replace prtyfam_lmn=51 if nation1==2 & voteint==401
replace prtyfam_lmn=21 if nation1==2 & voteint==201/*SP (Socialist Party - F)*/
replace prtyfam_lmn=51 if nation1==2 & voteint==400
replace prtyfam_lmn=41 if nation1==2 & voteint==300
replace prtyfam_lmn=31 if nation1==2 & voteint==800
replace prtyfam_lmn=31 if nation1==2 & voteint==801
replace prtyfam_lmn=91 if nation1==2 & voteint==701
replace prtyfam_lmn=41 if nation1==2 & voteint==303
replace prtyfam_lmn=41 if nation1==2 & voteint==301
replace prtyfam_lmn=91 if nation1==2 & voteint==600
replace prtyfam_glm=82 if nation1==2 & voteint==600
replace prtyfam_gn=83  if nation1==2 & voteint==600
replace prtyfam_lmn=41 if nation1==2 & voteint==306
replace prtyfam_lmn=81 if nation1==2 & voteint==601
replace prtyfam_lmn=41 if nation1==2 & voteint==307
replace prtyfam_ours=41 if nation1==2 & voteint==2
replace prtyfam_ours=41 if nation1==2 & voteint==700
replace prtyfam_ours=41 if nation1==2 & voteint==702
replace prtyfam_ours=41 if nation1==2 & voteint==703

*NL
replace prtyfam_lmn=21 if nation1==3 & voteint==200/*PvdA*/
replace prtyfam_lmn=51 if nation1==3 & voteint==400
replace prtyfam_glm=52 if nation1==3 & voteint==400
replace prtyfam_lmn=41 if nation1==3 & voteint==300
replace prtyfam_lmn=31 if nation1==3 & voteint==800
replace prtyfam_lmn=22 if nation1==3 & voteint==201/*PSP(Pacifist Soc)*/
replace prtyfam_lmn=41 if nation1==3 & voteint==301
replace prtyfam_lmn=21 if nation1==3 & voteint==407 /*DS'70 */
replace prtyfam_lmn=51 if nation1==3 & voteint==405
replace prtyfam_lmn=51 if nation1==3 & voteint==408
replace prtyfam_lmn=51 if nation1==3 & voteint==406
replace prtyfam_lmn=11 if nation1==3 & voteint==100
replace prtyfam_lmn=51 if nation1==3 & voteint==203
replace prtyfam_lmn=51 if nation1==3 & voteint==401
replace prtyfam_lmn=51 if nation1==3 & voteint==402
replace prtyfam_lmn=86 if nation1==3 & voteint==900
replace prtyfam_ours=61 if nation1==3 & voteint==900
replace prtyfam_lmn=51 if nation1==3 & voteint==403
replace prtyfam_lmn=91 if nation1==3 & voteint==600
replace prtyfam_gn=83 if nation1==3 & voteint==600
replace prtyfam_ours=82 if nation1==3 & voteint==600
replace prtyfam_ours=41 if nation1==3 & voteint==302
replace prtyfam_ours=51 if nation1==3 & voteint==404
replace prtyfam_ours=51 if nation1==3 & voteint==409

*DE
replace prtyfam_lmn=21 if nation1==4 & voteint==200/*SPD*/
replace prtyfam_lmn=51 if nation1==4 & voteint==400
replace prtyfam_glm=52 if nation1==4 & voteint==400
replace prtyfam_lmn=41 if nation1==4 & voteint==300
replace prtyfam_lmn=31 if nation1==4 & voteint==805
replace prtyfam_lmn=31 if nation1==4 & voteint==800
replace prtyfam_ours=12 if nation1==4 & voteint==103
*IT
replace prtyfam_lmn=51 if nation1==5 & voteint==400
replace prtyfam_lmn=71 if nation1==5 & voteint==500
replace prtyfam_lmn=11 if nation1==5 & voteint==100  /*pci*/
replace prtyfam_glm=11 if nation1==5 & voteint==100
replace prtyfam_lmn=21 if nation1==5 & voteint==200/*Partito Socialista Italiano*/
replace prtyfam_lmn=41 if nation1==5 & voteint==301
replace prtyfam_ours=11 if nation1==5 & voteint==103 /*pds*/
replace prtyfam_lmn=81 if nation1==5 & voteint==603
replace prtyfam_glm=82 if nation1==5 & voteint==603
replace prtyfam_gn=83 if nation1==5 & voteint==603
replace prtyfam_lmn=21 if nation1==5 & voteint==201/*PSDI*Partito Socialista Democratico Italiano*/
replace prtyfam_lmn=41 if nation1==5 & voteint==300
replace prtyfam_lmn=81 if nation1==5 & voteint==600
replace prtyfam_gn=84 if nation1==5 & voteint==600
replace prtyfam_lmn=22 if nation1==5 & voteint==205 /*Partito Radicale*/
replace prtyfam_ours=11 if nation1==5 & voteint==104
replace prtyfam_ours=11 if nation1==5 & voteint==102
replace prtyfam_lmn=91 if nation1==5 & voteint==700
replace prtyfam_ours=41 if nation1==5 & voteint==10
replace prtyfam_lmn=51 if nation1==5 & voteint==401
replace prtyfam_ours=51 if nation1==5 & voteint==403
replace prtyfam_lmn=91 if nation1==5 & voteint==704
replace prtyfam_glm=82 if nation1==5 & voteint==704
replace prtyfam_gn=85 if nation1==5 & voteint==704
replace prtyfam_ours=51 if nation1==5 & voteint==402
replace prtyfam_ours=11 if nation1==5 & voteint==101
replace prtyfam_ours=81 if nation1==5 & voteint==601
replace prtyfam_ours=31 if nation1==5 & voteint==800

*LU
replace prtyfam_lmn=11 if nation1==6 & voteint==100
replace prtyfam_lmn=21 if nation1==6 & voteint==201/*SDP Social Democrate */
replace prtyfam_lmn=21 if nation1==6 & voteint==200 /*SLAP/PSOL/LSAP*/
replace prtyfam_ours=31 if nation1==6 & voteint==803
replace prtyfam_lmn=51 if nation1==6 & voteint==400
replace prtyfam_lmn=41 if nation1==6 & voteint==300
replace prtyfam_ours=42 if nation1==6 & voteint==7
replace prtyfam_ours=12 if nation1==6 & voteint==101
*DK
replace prtyfam_lmn=21 if nation1==7 & voteint==200/*SD Socialdemokratiet */
replace prtyfam_lmn=61 if nation1==7 & voteint==300
replace prtyfam_lmn=41 if nation1==7 & voteint==302
replace prtyfam_lmn=22 if nation1==7 & voteint==101/*SF(Socialistik Folkeparti)*/
replace prtyfam_lmn=71 if nation1==7 & voteint==500
replace prtyfam_lmn=86 if nation1==7 & voteint==600
replace prtyfam_gn=83 if nation1==7 & voteint==600
replace prtyfam_lmn=11 if nation1==7 & voteint==100
replace prtyfam_lmn=41 if nation1==7 & voteint==400
replace prtyfam_lmn=22 if nation1==7 & voteint==201/*V. Soc. (Left Socialist)*/
replace prtyfam_lmn=51 if nation1==7 & voteint==401
replace prtyfam_gn=83 if nation1==7 & voteint==601
replace prtyfam_ours=83 if nation1==7 & voteint==601
replace prtyfam_ours=11 if nation1==7 & voteint==104
replace prtyfam_ours=91 if nation1==7 & voteint==701
*IE
replace prtyfam_lmn=21 if nation1==8 & voteint==200 /*LAB (Labour party)*/
replace prtyfam_ours=21 if nation1==8 & voteint==200
replace prtyfam_lmn=21 if nation1==8 & voteint==201/*Workers Party, WP*/
replace prtyfam_lmn=22 if nation1==8 & voteint==202/*DL / New Agenda*/
replace prtyfam_lmn=51 if nation1==8 & voteint==400
replace prtyfam_lmn=52 if nation1==8 & voteint==400
replace prtyfam_lmn=41 if nation1==8 & voteint==500
replace prtyfam_ours=51 if nation1==8 & voteint==500/*Fianna Fail */
replace prtyfam_lmn=41 if nation1==8 & voteint==300
replace prtyfam_ours=41 if nation1==8 & voteint==300
replace prtyfam_lmn=31 if nation1==8 & voteint==800
replace prtyfam_lmn=91 if nation1==8 &voteint==100
*GB
replace prtyfam_lmn=21 if nation1==9 & voteint==200/*Labour*/
replace prtyfam_glm=21 if nation1==9 & voteint==200
replace prtyfam_lmn=71 if nation1==9 & voteint==500
replace prtyfam_glm=71 if nation1==9 & voteint==500
replace prtyfam_lmn=41 if nation1==9 & voteint==301
replace prtyfam_glm=41 if nation1==9 & voteint==301
replace prtyfam_lmn=91 if nation1==9 & voteint==700
replace prtyfam_lmn=21 if nation1==9 & voteint==300/*SDP(= Social Democrats and Labour Party)*/
replace prtyfam_glm=31 if nation1==9 & voteint==300
replace prtyfam_lmn=91 if nation1==9 & voteint==701
*GR
replace prtyfam_lmn=71 if nation1==11 & voteint==400
replace prtyfam_lmn=21 if nation1==11 & voteint==200/*PASOK*/
replace prtyfam_lmn=11 if nation1==11 & voteint==101
replace prtyfam_ours=11 if nation1==11 & voteint==100
replace prtyfam_lmn=71 if nation1==11 & voteint==5
replace prtyfam_ours=21 if nation1==11 & voteint==10/*DIKKI Demokratiko Kinima*/
replace prtyfam_ours=41 if nation1==11 & voteint==300
replace prtyfam_ours=41 if nation1==11 & voteint==301
replace prtyfam_ours=51 if nation1==11 & voteint==401
*ES
replace prtyfam_lmn=21 if nation1==12 & voteint==200/*PSOE*/
replace prtyfam_ours=11 if nation1==12 & voteint==100
replace prtyfam_lmn=71 if nation1==12 & voteint==300
replace prtyfam_lmn=71 if nation1==12 & voteint==500
replace prtyfam_lmn=91 if nation1==12 & voteint==301
replace prtyfam_ours=92 if nation1==12 & voteint==301
replace prtyfam_lmn=91 if nation1==12 & voteint==700
replace prtyfam_ours=22 if nation1==12 & voteint==9/*Partido Andalucista*/
replace prtyfam_lmn=91 if nation1==12 & voteint==20
replace prtyfam_ours=22 if nation1==12 & voteint==20/*ERC, Esquerra Republicana de Cataluña 
*/
replace prtyfam_lmn=91 if nation1==12 & voteint==27
replace prtyfam_lmn=91 if nation1==12 & voteint==23
replace prtyfam_ours=91 if nation1==12 & voteint==701
replace prtyfam_ours=91 if nation1==12 & voteint==706
*PT
replace prtyfam_lmn=21 if nation1==13 & voteint==200/*PS*/
replace prtyfam_lmn=41 if nation1==13 & voteint==300
replace prtyfam_lmn=51 if nation1==13 & voteint==201
replace prtyfam_lmn=11 if nation1==13 & voteint==103
replace prtyfam_lmn=41 if nation1==13 & voteint==203
replace prtyfam_lmn=11 if nation1==13 & voteint==100
replace prtyfam_lmn=11 if nation1==13 & voteint==101
*NO
replace prtyfam_lmn=21 if nation1==15 & voteint==200/*Labour p.*/
replace prtyfam_lmn=21 if nation1==15 & voteint==201/*sv, Socialistik Venstre*/
replace prtyfam_lmn=71 if nation1==15 & voteint==500
replace prtyfam_lmn=86 if nation1==15 & voteint==600
replace prtyfam_glm=82 if nation1==15 & voteint==600
replace prtyfam_gn=83 if nation1==15 & voteint==600
replace prtyfam_lmn=61 if nation1==15 & voteint==900
replace prtyfam_lmn=51 if nation1==15 & voteint==400
replace prtyfam_glm=52 if nation1==15 & voteint==400
replace prtyfam_lmn=41 if nation1==15 & voteint==300
*FI
replace prtyfam_lmn=21 if nation1==16 & voteint==200/*sdp*/
replace prtyfam_lmn=11 if nation1==16 & voteint==100
replace prtyfam_lmn=31 if nation1==16 & voteint==800
replace prtyfam_lmn=71 if nation1==16 & voteint==500
replace prtyfam_ours=83 if nation1==16 & voteint==601
replace prtyfam_lmn=91 if nation1==16 & voteint==700
replace prtyfam_lmn=61 if nation1==16 & voteint==900
replace prtyfam_lmn=51 if nation1==16 & voteint==600
replace prtyfam_lmn=86 if nation1==16 & voteint==901
replace prtyfam_ours=61 if nation1==16 & voteint==901
replace prtyfam_ours=41 if nation1==16 & voteint==2
replace prtyfam_ours=41 if nation1==16 & voteint==300

*SE
replace prtyfam_lmn=21 if nation1==17 & voteint==200/*S(Social Democrats)*/
replace prtyfam_lmn=31 if nation1==17 & voteint==800
replace prtyfam_lmn=11 if nation1==17 & voteint==100
replace prtyfam_glm=11 if nation1==17 & voteint==100
replace prtyfam_lmn=41 if nation1==17 & voteint==302
replace prtyfam_lmn=71 if nation1==17 & voteint==501
replace prtyfam_lmn=51 if nation1==17 & voteint==400
replace prtyfam_lmn=52 if nation1==17 & voteint==400
replace prtyfam_lmn=61 if nation1==17 & voteint==301
*AT
replace prtyfam_lmn=21 if nation1==18 & voteint==200/*SPO*/
replace prtyfam_lmn=31 if nation1==18 & voteint==800
replace prtyfam_lmn=86 if nation1==18 & voteint==600
replace prtyfam_glm=82 if nation1==18 & voteint==600
replace prtyfam_gn=83  if nation1==18 & voteint==600
replace prtyfam_lmn=51 if nation1==18 & voteint==401
replace prtyfam_glm=52 if nation1==18 & voteint==401
replace prtyfam_lmn=41 if nation1==18 & voteint==301

/* Generate nt1 variable that extracts the first 2
   letters of nation1 variable, e.g., AUSTRIA becomes AU */
decode nation1, gen(cntry) 
replace cntry="GB" if nation1==9
generate nt1 = substr(cntry,1,2) 
replace nt1="AT" if nt1=="au"
replace nt1="DK" if nt1=="de"
replace nt1="IE" if nt1=="ir"
replace nt1="DE" if nt1=="GE"
replace nt1="ES" if nt1=="sp"
replace nt1="PT" if nt1=="po"
replace nt1="SE" if nt1=="sw"
replace nt1="NL" if nt1=="ne"
replace nt1="BE" if nt1=="be"
replace nt1="FI" if nt1=="fi"
replace nt1="FR" if nt1=="fr"
replace nt1="GR" if nt1=="gr"
replace nt1="LU" if nt1=="lu"
replace nt1="IT" if nt1=="it"
replace nt1="NO" if nt1=="no"

tab nt1 /*16 countries*/

/* Part 1. Calculate the gender gap for party families for every country/year */

/* Party families: indicates if respondent voted for a party included in the 
   party family */
gen prtyfam_rr=.
gen prtyfam_left=.
gen prtyfam_left_wgreen=.
gen prtyfam_cd=.
gen prtyfam_cons=.
gen prtyfam_radicalleft=.
gen prtyfam_lib=.
gen prtyfam_sd=.
gen prtyfam_grn=.

replace prtyfam_rr = (prtyfam_lmn<=86&prtyfam_lmn>=81)|(prtyfam_glm<=86&prtyfam_glm>=81) | ///
	(prtyfam_gn<=86&prtyfam_gn>=81)|(prtyfam_ours<=86&prtyfam_ours>=81)
replace prtyfam_left = (prtyfam_lmn==22|prtyfam_lmn==21)|(prtyfam_glm==22|prtyfam_glm==21) | ///
	(prtyfam_ours==22|prtyfam_ours==21)
replace prtyfam_sd = (prtyfam_lmn==21|prtyfam_glm==21|prtyfam_ours==21)
replace prtyfam_radicalleft = (prtyfam_lmn==11|prtyfam_lmn==12|prtyfam_lmn==22)|(prtyfam_glm==11|prtyfam_glm==12|prtyfam_glm==22) |(prtyfam_ours==11|prtyfam_ours==12|prtyfam_ours==22)
replace prtyfam_left_wgreen=(prtyfam_lmn==22|prtyfam_lmn==21|prtyfam_lmn==31) ///
     |(prtyfam_glm==22|prtyfam_glm==21|prtyfam_glm==31) | ///
	(prtyfam_ours==22|prtyfam_ours==21|prtyfam_ours==31)  
replace prtyfam_cd = (prtyfam_lmn<=59&prtyfam_lmn>=50)|(prtyfam_glm<=59&prtyfam_glm>=50) | ///
	(prtyfam_gn<=59&prtyfam_gn>=50)|(prtyfam_ours<=59&prtyfam_ours>=50)
replace prtyfam_cons = (prtyfam_lmn<=79&prtyfam_lmn>=70)|(prtyfam_glm<=79&prtyfam_glm>=70) | ///
	(prtyfam_gn<=79&prtyfam_gn>=70)|(prtyfam_ours<=79&prtyfam_ours>=70)
replace prtyfam_lib = (prtyfam_lmn==41|prtyfam_lmn==42)|(prtyfam_glm==41|prtyfam_glm==42) | ///
	(prtyfam_ours==41|prtyfam_ours==42) | (prtyfam_gn==41|prtyfam_gn==42)
replace prtyfam_grn=prtyfam_lmn==31 ///
     |prtyfam_glm==31 | ///
	prtyfam_ours==31  

/* Generate the gender specific vote share variabe for SD 
   Numerator: number of M or F in country C, in round j, who voted for sd 
   Denominator: number of M or F in country C, in round j (who voted, screening for turnout above)*/
   
  * Denominator * 
by nt1 year gndr, sort: egen countgndrpf=count(gndr)
  
 * Numerator *
by nt1 year gndr, sort: egen countgndrsd=count(gndr) if prtyfam_sd==1

gen     vsfpfsd = .
replace vsfpfsd = countgndrsd/countgndrpf  if gndr==0
gen     vsmpfsd = .
replace vsmpfsd = countgndrsd/countgndrpf  if gndr==1

by nt1 year prtyfam_sd, sort: egen vsfpfsdunique=max(vsfpfsd)
by nt1 year prtyfam_sd, sort: egen vsmpfsdunique=max(vsmpfsd)

* sd gender gap: VSM-VSF**
gen gendergappfsd=vsmpfsdunique-vsfpfsdunique


/* Generate the gender specific vote share variabe for Radical right
   Numerator: number of M or F in country C, in round j, who voted for radical right 
   Denominator: number of M or F in country C, in round j (who voted, screening for turnout above)*/
   
 * Numerator *
by nt1 year gndr, sort: egen countgndrrr=count(gndr) if prtyfam_rr==1

gen     vsfpfrr = .
replace vsfpfrr = countgndrrr/countgndrpf  if gndr==0
gen     vsmpfrr = .
replace vsmpfrr = countgndrrr/countgndrpf  if gndr==1

by nt1 year prtyfam_rr, sort: egen vsfpfrrunique=max(vsfpfrr)
by nt1 year prtyfam_rr, sort: egen vsmpfrrunique=max(vsmpfrr)

*   RR gendergap: VSM-VSF 
gen gendergappfrr=vsmpfrrunique-vsfpfrrunique

/* Generate the gender specific vote share variabe for Christian Democrats
   Numerator: number of M or F in country C, in round j, who voted for Cristian Democrats 
   Denominator: number of M or F in country C, in round j (who voted, screening for turnout above)*/

by nt1 year gndr, sort: egen countgndrcd=count(gndr) if prtyfam_cd==1
gen     vsfpfcd = .
replace vsfpfcd = countgndrcd/countgndrpf  if gndr==0
gen     vsmpfcd = .
replace vsmpfcd = countgndrcd/countgndrpf  if gndr==1

by nt1 year prtyfam_cd, sort: egen vsfpfcdunique=max(vsfpfcd)
by nt1 year prtyfam_cd, sort: egen vsmpfcdunique=max(vsmpfcd)

*   CD gender gap: VSM-VSF 
gen gendergappfcd=vsmpfcdunique-vsfpfcdunique

/* Generate the gender specific vote share variabe for Conservatives
   Numerator: number of M or F in country C, in round j, who voted for Conservatives
   Denominator: number of M or F in country C, in round j (who voted, screening for turnout above)*/

by nt1 year gndr, sort: egen countgndrcons=count(gndr) if prtyfam_cons==1
gen     vsfcons = .
replace vsfcons = countgndrcons/countgndrpf  if gndr==0
gen     vsmcons = .
replace vsmcons = countgndrcons/countgndrpf  if gndr==1

by nt1 year prtyfam_cons, sort: egen vsfconsunique=max(vsfcons)
by nt1 year prtyfam_cons, sort: egen vsmconsunique=max(vsmcons)

*   Conservative gender gap: VSM-VSF 
gen gendergapcons=vsmconsunique-vsfconsunique


 /* Generate the gender specific vote share variabe for radical Left 
   Numerator: number of M or F in country C, in round j, who voted for radical left 
   Denominator: number of M or F in country C, in round j (who voted, screening for turnout above)*/
    
 * Numerator *
by nt1 year gndr, sort: egen countgndrrl=count(gndr) if prtyfam_radicalleft==1

gen     vsfpfrl = .
replace vsfpfrl = countgndrrl/countgndrpf  if gndr==0
gen     vsmpfrl = .
replace vsmpfrl = countgndrrl/countgndrpf  if gndr==1

by nt1 year prtyfam_radicalleft, sort: egen vsfpfrlunique=max(vsfpfrl)
by nt1 year prtyfam_radicalleft, sort: egen vsmpfrlunique=max(vsmpfrl)

* Radical Left gendergap: VSM-VSF**
gen gendergappfrl=vsmpfrlunique-vsfpfrlunique

 /* Generate the gender specific vote share variabe for liberals 
   Numerator: number of M or F in country C, in round j, who voted for liberals 
   Denominator: number of M or F in country C, in round j (who voted, screening for turnout above)*/
   
 * Numerator *
by nt1 year gndr, sort: egen countgndrlb=count(gndr) if prtyfam_lib==1

gen     vsfpflb = .
replace vsfpflb = countgndrlb/countgndrpf  if gndr==0
gen     vsmpflb = .
replace vsmpflb = countgndrlb/countgndrpf  if gndr==1

by nt1 year prtyfam_lib, sort: egen vsfpflbunique=max(vsfpflb)
by nt1 year prtyfam_lib, sort: egen vsmpflbunique=max(vsmpflb)

* Liberals gendergap: VSM-VSF**
gen gendergappflb=vsmpflbunique-vsfpflbunique

 /* Generate the gender specific vote share variabe for GREEN PARTY FAMILY
   Numerator: number of M or F in country C, in round j, who voted for green 
   Denominator: number of M or F in country C, in round j (who voted, screening for turnout above)*/
   
 * Numerator for left vote share
by nt1 year gndr, sort: egen countgndrg=count(gndr) if prtyfam_grn==1
gen     vsfpf_g = .
replace vsfpf_g = countgndrg/countgndrpf  if gndr==0
gen     vsmpf_g = .
replace vsmpf_g = countgndrg/countgndrpf  if gndr==1

by nt1 year prtyfam_grn, sort: egen vsfpfgrnunique_g=max(vsfpf_g)
by nt1 year prtyfam_grn, sort: egen vsmpfgrnunique_g=max(vsmpf_g)

* green gendergap: VSM-VSF**
gen gendergappf_g=vsmpfgrnunique_g-vsfpfgrnunique_g


/* preparation for aggregate figures of the gender gaps*/

* Unique gender gap variable for every year and country : SD
egen ggsdunique=tag(gendergappfsd cntry year)
by nt1 year prtyfam_sd, sort: egen ggsdunique1=max(gendergappfsd) if ggsdunique==1

* Unique gender gap variable for every year and country : RR
egen ggrrunique=tag(gendergappfrr cntry year)
by cntry year prtyfam_rr, sort: egen ggrrunique1=max(gendergappfrr) if ggrrunique==1

* Unique gender gap variable for every year and country : CD
egen ggcdunique=tag(gendergappfcd cntry year)
by cntry year prtyfam_cd, sort: egen ggcdunique1=max(gendergappfcd) if ggcdunique==1

* Unique gender gap variable for every year and country : Conservative
egen ggconsunique=tag(gendergapcons cntry year)
by cntry year prtyfam_cons, sort: egen ggconsunique1=max(gendergapcons) if ggconsunique==1

* Unique gender gap variable for every year and country : Radical Left
egen ggrlunique=tag(gendergappfrl cntry year)
by nt1 year prtyfam_radicalleft, sort: egen ggrlunique1=max(gendergappfrl) if ggrlunique==1

* Unique gender gap variable for every year and country : Liberals
egen gglbunique=tag(gendergappflb cntry year)
by nt1 year prtyfam_lib, sort: egen gglbunique1=max(gendergappflb) if gglbunique==1

* Unique gender gap variable for every year and country :  GREEN 
egen gggrnunique_g=tag(gendergappf_g cntry year)
by nt1 year prtyfam_grn, sort: egen ggunique_g=max(gendergappf_g) if gggrnunique_g==1


gen ggsdper=ggsdunique1*100

* cntryrr: captures countries that have RR in year j 
generate cntryrr=. 
replace cntryrr=1 if  nt1=="AT"
replace cntryrr=1 if (nt1=="BE" & year>=1988)
replace cntryrr=1 if (nt1=="DK")
replace cntryrr=1 if (nt1=="FI" & (year<=1995 | year>= 1999))
replace cntryrr=1 if (nt1=="FR" &  year>=1986) 
replace cntryrr=1 if (nt1=="IT")
replace cntryrr=1 if (nt1=="NL" & (year>=1970 & year<=1980))
replace cntryrr=1 if (nt1=="NL" & (year>=1982 & year<=1985)) 
replace cntryrr=1 if (nt1=="NO")
replace cntryrr=0 if cntryrr==.

* Figure 1a: Gender gap for the SD overtime broken down by countryear with and without RR in parliament 

twoway lpolyci ggsdper year if cntryrr==0 , degree(2) level(95) clstyle(p1line) lcol(black) fcolor(gs8*.7) acolor(538rs9%50) level(95) lwidth(thick) alsty(nono) yline(0) || lpolyci  ggsdper year if cntryrr==1,  degree(2) level(95) lcol(red) lp(solid)fcolor(red*.7) acolor(538rs9%50) level(95) lwidth(thick) alsty(nono) ytitle("Gender gap for Social Democratic parties") xtitle("") ///
										   caption(Source: EB trendfile)  /// 
										   xtitle("") fxsize(100) ///
										   msymbol (i) graphregion(color(white)) ///
										   ylabel(,nogrid) legend(off) 
graph save "GGsd_simple", replace

* Balanced sample of countries (only 9 countries)*
twoway lpolyci ggsdper year if cntryrr==0 & (nt1=="LU" | nt1=="DE" |nt1=="BE"|nt1=="FR" |nt1=="IT"|nt1=="NL"|nt1=="IE" |nt1=="DK"|nt1=="GB") , degree(2) level(95) alsty(nono) clstyle(p1line)   lcol(black) fcolor(gs8*.7) acolor(538rs9%50) level(95) lwidth(thick) lpattern(solid)  yline(0) || lpolyci  ggsdper year if cntryrr==1 & (nt1=="LU" | nt1=="DE" |nt1=="BE"|nt1=="FR" |nt1=="IT"|nt1=="NL"|nt1=="IE" |nt1=="DK"|nt1=="GB"),  degree(2)lcol(red)lpattern(solid) alsty(nono) fcolor(red*.7) acolor(538rs9%50) level(95) lwidth(thick) level(95) ytitle("Gender gap for Social Democratic parties") xtitle("") ///
										   caption(Source: EB trendfile)  /// 
										   xtitle("") fxsize(100) ///
										   msymbol (i) graphregion(color(white)) ///
										   ylabel(,nogrid) legend(off) 
graph save "GGsd_balanced_simple", replace

* Figure F1: Gender gap for SD overtime broken down by countryear with and without RR in parliament 
* cntryrr: captures countries that have RR in year j 

twoway scatter ggsdper year if (nt1=="ES" & cntryrr==1), yline(0) ytitle("Gender gap for Social Democratic parties") xtitle("") ///
										   caption(Source: EB trendfile)  /// 
										   xtitle("") connect (l) lpattern(solid) ///
										   lcolor(red) msymbol (i) fxsize(100) ///
										   ylabel(,nogrid) legend(off) ///
		||scatter ggsdper year if (nt1=="GB" & cntryrr==1), connect (l) lpattern(solid) lcolor(red) msymbol (i) ///
		||scatter ggsdper year if (nt1=="IE" & cntryrr==1), connect (l) lpattern(solid) lcolor(red) msymbol (i) ///
		||scatter ggsdper year if (nt1=="LU" & cntryrr==1), connect (l) lpattern(solid) lcolor(red) msymbol (i) ///
		||scatter ggsdper year if (nt1=="PT" & cntryrr==1), connect (l) lpattern(solid) lcolor(red) msymbol (i) ///
		||scatter ggsdper year if (nt1=="DE" & cntryrr==1), connect (l) lpattern(solid) lcolor(red) msymbol (i) ///
		||scatter ggsdper year if (nt1=="AT" & cntryrr==1), connect (l) lpattern(solid) lcolor(red) msymbol (i) ///
		||scatter ggsdper year if (nt1=="BE" & cntryrr==1), connect (l) lpattern(solid) lcolor(red) msymbol (i) ///
		||scatter ggsdper year if (nt1=="FR" & cntryrr==1), connect (l) lpattern(solid) lcolor(red) msymbol (i) ///
		||scatter ggsdper year if (nt1=="GR" & cntryrr==1), connect (l) lpattern(solid) lcolor(red) msymbol (i) ///
		||scatter ggsdper year if (nt1=="IT" & cntryrr==1), connect (l) lpattern(solid) lcolor(red) msymbol (i) ///
		||scatter ggsdper year if (nt1=="NL" & cntryrr==1), connect (l) lpattern(solid) lcolor(red) msymbol (i) ///
		||scatter ggsdper year if (nt1=="SE" & cntryrr==1), connect (l) lpattern(solid) lcolor(red) msymbol(i) ///
		||scatter ggsdper year if (nt1=="NO" & cntryrr==1), connect (l) lpattern(solid) lcolor(red) msymbol (i) ///
		||scatter ggsdper year if (nt1=="FI" & cntryrr==1), connect (l) lpattern(solid) lcolor(red) msymbol (i) ///
		||scatter ggsdper year if (nt1=="DK" & cntryrr==1), connect (l) lpattern(solid) lcolor(red) msymbol (i) ///
		||scatter ggsdper year if (nt1=="ES" & cntryrr==1), connect (l) lpattern(solid) lcolor(red) msymbol (i) ///
		||scatter ggsdper year if (nt1=="GB" & cntryrr==0), connect (l) lpattern(solid) lcolor(black) msymbol (i) ///
		||scatter ggsdper year if (nt1=="IE" & cntryrr==0), connect (l) lpattern(solid) lcolor(black) msymbol (i) ///
		||scatter ggsdper year if (nt1=="LU" & cntryrr==0), connect (l) lpattern(solid) lcolor(black) msymbol (i) ///
		||scatter ggsdper year if (nt1=="PT" & cntryrr==0), connect (l) lpattern(solid) lcolor(black) msymbol (i) ///
		||scatter ggsdper year if (nt1=="DE" & cntryrr==0), connect (l) lpattern(solid) lcolor(black) msymbol (i) ///
		||scatter ggsdper year if (nt1=="AT" & cntryrr==0), connect (l) lpattern(solid) lcolor(black) msymbol (i) ///
		||scatter ggsdper year if (nt1=="BE" & cntryrr==0), connect (l) lpattern(solid) lcolor(black) msymbol (i) ///
		||scatter ggsdper year if (nt1=="FR" & cntryrr==0), connect (l) lpattern(solid) lcolor(black) msymbol (i) ///
		||scatter ggsdper year if (nt1=="GR" & cntryrr==0), connect (l) lpattern(solid) lcolor(black) msymbol (i) ///
		||scatter ggsdper year if (nt1=="IT" & cntryrr==0), connect (l) lpattern(solid) lcolor(black) msymbol (i) ///
		||scatter ggsdper year if (nt1=="NL" & cntryrr==0), connect (l) lpattern(solid) lcolor(black) msymbol (i) ///
		||scatter ggsdper year if (nt1=="SE" & cntryrr==0), connect (l) lpattern(solid) lcolor(black) msymbol(i) ///
		||scatter ggsdper year if (nt1=="NO" & cntryrr==0), connect (l) lpattern(solid) lcolor(black) msymbol (i) ///
		||scatter ggsdper year if (nt1=="FI" & cntryrr==0), connect (l) lpattern(solid) lcolor(black) msymbol (i) ///
		||scatter ggsdper year if (nt1=="DK" & cntryrr==0), connect (l) lpattern(solid) lcolor(black) msymbol (i) ///
		||scatter ggsdper year if (nt1=="ES" & cntryrr==0), connect (l) lpattern(solid) lcolor(black) msymbol (i) ///
		|| lpolyci  ggsdper year if cntryrr==0, degree(2)  clstyle(p1line)lcol(black) fcolor(gs8*.7) acolor(538rs9%50) level(95) lwidth(thick)alsty(nono)  lpattern(solid)  ///
		|| lpolyci  ggsdper year if cntryrr==1, degree(2) clstyle(p1line) lcol(red) fcolor(red*.7) acolor(538rs9%50)alsty(nono) level(95) lwidth(thick) lpattern(solid)
graph save "EB GGsd w wo RR", replace

* Figure 1b: Gender gap for the RR over Year
gen ggrrper = ggrrunique1*100
twoway lpolyci ggrrper year , degree(2) level(95) clstyle(p1line)  yline(0) ytitle("Gender gap for the far right") xtitle("") ///
										   caption(Source: EB trendfile)  /// 
										   xtitle("") fxsize(100) ///
										   msymbol (i) graphregion(color(white)) ///
										   ylabel(,nogrid) legend(off) 
graph save "GGrr_simple", replace


*Gender gap for the RR over time (only 9 countries, balanced sample)
twoway lpolyci ggrrper year if (nt1=="LU" | nt1=="DE" |nt1=="BE"|nt1=="FR" |nt1=="IT"|nt1=="NL"|nt1=="IE"|nt1=="DK" |nt1=="GB") , degree(2) level(95) clstyle(p1line)  yline(0) ytitle("Gender gap for the radical right") xtitle("") ///
										   caption(Source: EB trendfile)  /// 
										   xtitle("") fxsize(100) ///
										   msymbol (i) graphregion(color(white)) ///
										   ylabel(,nogrid) legend(off) 
graph save "GGrr_balanced_simple", replace

* Figure F1b: Gender gap for the RR over Year

twoway scatter ggrrper year if nt1=="ES", yline(0) ytitle("Gender gap for the far right") xtitle("") ///
										   caption(Source: EB trendfile)  /// 
										   xtitle("") connect (l) lpattern("__...") fxsize(100) ///
										   lcolor(black) msymbol (i) graphregion(color(white)) ///
										   ylabel(,nogrid) legend(off) ///
		||scatter ggrrper year if nt1=="GB", connect (l) lpattern(solid) lcolor(black) msymbol (i) ///
		||scatter ggrrper year if nt1=="IE", connect (l) lpattern(dot) lcolor(black) msymbol (i) ///
		||scatter ggrrper year if nt1=="LU", connect (l) lpattern("___--") lcolor(black) msymbol (i) ///
		||scatter ggrrper year if nt1=="PT", connect (l) lpattern(shortdash_dot_dot) lcolor(black) msymbol (i) ///
		||scatter ggrrper year if nt1=="DE", connect (l) lpattern(shortdash) lcolor(black) msymbol (i) ///
		||scatter ggrrper year if nt1=="AT", connect (l) lpattern(longdash) lcolor(black) msymbol (i) ///
		||scatter ggrrper year if nt1=="BE", connect (l) lpattern(dash) lcolor(black) msymbol (i) ///
		||scatter ggrrper year if nt1=="FR", connect (l) lpattern(longdash_dot) lcolor(black) msymbol (i) ///
		||scatter ggrrper year if nt1=="GR", connect (l) lpattern(dash_dot) lcolor(black) msymbol (i) ///
		||scatter ggrrper year if nt1=="IT", connect (l) lpattern("-..-..") lcolor(black) msymbol (i) ///
		||scatter ggrrper year if nt1=="NL", connect (l) lpattern("-...-...") lcolor(black) msymbol (i) ///
		||scatter ggrrper year if nt1=="SE", connect (l) lpattern("--..--..") lcolor(black) msymbol(i) ///
		||scatter ggrrper year if nt1=="NO", connect (l) lpattern("___..___") lcolor(black) msymbol (i) ///
		||scatter ggrrper year if nt1=="FI", connect (l) lpattern("___ ___") lcolor(black) msymbol (i) ///
		||scatter ggrrper year if nt1=="DK", connect (l) lpattern("___.___") lcolor(black) msymbol (i) ///
		||lpolyci  ggrrper year, degree(3) clstyle(p1line) level(95) 
graph save "EB GGRR", replace

/*3. Save dataset with party families and calculated gender gaps */
save eb_modified1-10, replace

/*Part 3: Combine EB and ESS panels for figures*/ 			   

*Figure 1a*
graph combine "GGsd_simple""ESS_GGsd_simple", ycommon title((a))col(2)
graph save "GGsd combined_simple", replace
*Figure 1b*
graph combine "GGrr_simple" "ESS_GGrr_simple", ycommon title((b)) col(2)
graph save "GGrr combined_simple", replace
*combined Figure 1ab
graph combine "GGsd combined_simple.gph" "GGrr combined_simple.gph", ycommon col(2)
graph save "combined f1_simple"
* Figure F1a*
graph combine "EB GGsd w wo RR""ESS GGsd w wo RR", ycommon col(2)
graph save "GGsd combined", replace
* Figure F1b*
graph combine "EB GGRR""ESS GG RR", ycommon col(2)
graph save "GGrr combined", replace
*combined Figure F1ab
graph combine "GGsd combined.gph" "GGrr combined.gph", ycommon col(2)
graph save "combined f1"
* Figure 1a: only 9 countries (balanced sample)
graph combine "GGsd_balanced_simple" "ESS GGsd_balanced_simple", ycommon title((a))col(2) 
graph save "GGsd combined 9", replace
* Figure 1b: only 9 countries (balanced sample)
graph combine "GGrr_balanced_simple" "ESS_GGrr_balance_simple", ycommon title((b)) col(2) 
graph save "GGrr combined 9", replace
*combined Figure 1ab (balanced sample)
graph combine "GGsd combined 9" "GGrr combined 9", ycommon col(2)
graph save "combined f1_balanced"




log close  
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
